Berlin
Data for Berlin
Data for the city of Berlin are periodically reported from the Landesamt für Gesundheit und Soziales of the Berlin Council.
import os,sys
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(''), '../../Code')))
from hedera_covid import DataHandlerBerlin, smooth_data
# for plotly
from plotly.offline import iplot
from plotly.offline import init_notebook_mode, plot
from IPython.core.display import display, HTML
import plotly as py
import plotly.tools as tls
import datetime
import numpy as np
import pandas as pd
# load data
berlin = DataHandlerBerlin()
# intensive care
berlin_h = pd.read_excel('../../DE-Data/intensive-care-data.xlsx',sheet_name = 'berlin')
germany_h = pd.read_excel('../../DE-Data/intensive-care-data.xlsx',sheet_name = 'germany')
bayern_h = pd.read_excel('../../DE-Data/intensive-care-data.xlsx',sheet_name = 'bayern')
import plotly.graph_objects as go
init_notebook_mode(connected=True)
fig = go.Figure()
N = len(berlin.data['dates'])
fig.add_trace(go.Bar(
x=berlin.data['dates'],
y=smooth_data(berlin.data['confirmed'],7),
name='Reported Cases (Total = ' + str(berlin.data['confirmed'][N-1]) + ')'
))
fig.add_trace(go.Bar(
x=berlin.data['dates'],
y=smooth_data(berlin.data['deaths'],7),
name='Reported Deaths (Total = ' + str(berlin.data['deaths'][N-1]) + ')'
))
fig.add_trace(go.Scatter(
x=berlin.data['dates'],
y=smooth_data(berlin.data['stationary'],7),
name='In Hospital (Total = ' + str(berlin.data['stationary'][N-1]) + ')'
))
fig.add_trace(go.Scatter(
x=berlin.data['dates'],
y=smooth_data(berlin.data['intensive'],7),
name='Intensive Care (Total = ' + str(berlin.data['intensive'][N-1]) + ')'
))
fig.update_layout(xaxis_tickangle=-90)
plot(fig, filename = 'figure.html')
display(HTML('figure.html'))
import plotly.graph_objects as go
init_notebook_mode(connected=True)
fig = go.Figure()
fig.add_trace(go.Bar(
x=berlin.data['dates'],
y=berlin.data['confirmed_daily'],
name='Daily Reported Cases (Total = ' + str(berlin.data['confirmed'][N-1]) + ')',
marker = {'color': "#117A65"}
))
n_smooth = 7
fig.add_trace(go.Scatter(
x=berlin.data['dates'],
y=smooth_data(berlin.data['confirmed_daily'],n=n_smooth),
name='Averaged over ' + str(n_smooth) + ' days',
marker = {'color': "#48C9B0"}
))
fig.update_layout(xaxis_tickangle=-90)
fig.update_layout(legend=dict(x=0.1, y=1.2),legend_orientation="h",font_size=10)
plot(fig, filename = 'figure.html')
display(HTML('figure.html'))
Notice that the reporting has an intrinsic periodicity (1 week), which might be due to the modality of reporting results of different testing units. On Sundays, reported cases are always much lower than on other days.
import plotly.graph_objects as go
init_notebook_mode(connected=True)
fig = go.Figure()
fig.add_trace(go.Bar(
x=berlin.data['dates'],
y=berlin.data['deaths_daily'],
name='Daily Reported Deaths (Total = ' + str(berlin.data['deaths'][N-1]) + ')',
marker = {'color':'#F7DC6F'}
))
n_smooth = 7
fig.add_trace(go.Scatter(
x=berlin.data['dates'],
y=smooth_data(berlin.data['deaths_daily'],n=n_smooth),
name='Averaged over ' + str(n_smooth) + ' days',
marker = {'color': "#EB984E"}
))
fig.update_layout(xaxis_tickangle=-90)
fig.update_layout(legend=dict(x=0.1, y=1.2),legend_orientation="h",font_size=10)
plot(fig, filename = 'figure.html')
display(HTML('figure.html'))
import plotly.graph_objects as go
init_notebook_mode(connected=True)
fig = go.Figure()
fig.add_trace(go.Bar(
x=germany_h['Date'],
y=germany_h['Percentage'],
name='Germany',
marker = {'color': "#F7DC6F"}
))
fig.add_trace(go.Bar(
x=berlin_h['Date'],
y=berlin_h['Percentage'],
name='Berlin',
marker = {'color': "#117A65"}
))
fig.add_trace(go.Bar(
x=bayern_h['Date'],
y=bayern_h['Percentage'],
name='Bayern',
marker = {'color': "#48C9B0"}
))
fig.update_layout(xaxis_tickangle=-90)
fig.update_layout(title='Percentage of intensive beds free',
font_size=10)
#fig.show()
plot(fig, filename = 'figure.html')
display(HTML('figure.html'))
g=10
from IPython.display import display, Markdown
N = len(germany_h['Reporting'])
g= germany_h['Reporting'][N-1]
d = germany_h['Date'][N-1]
display(Markdown(f'**Note** The graphics take into account only the reporting entities ({g} on {d})'))